from lxml import etree

if __name__ == '__main__':
    root = etree.Element("root")

    # child1 = etree.Element("child1", _class="a")
    child1 = etree.Element("child1", {"class": "a"})
    child1.text = "a"

    child2 = etree.Element("child2", {"class": "b"})
    child2.text = "b"
    child3 = etree.Element("child3", {"class": "c"})
    child3.text = "c"

    root.append(child1)
    root.append(child2)
    root.append(child3)

    print(etree.tostring(root))
